﻿<Window x:Class="UIAdapters.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="clr-namespace:UIAdapters" 
	xmlns:cab="http://schemas.scsfcontrib.com/extensions/wpf/wpfcab" 
    Title="UIAdapters"
	WindowState="Maximized">
    <Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*"/>
		</Grid.ColumnDefinitions>

		<Menu x:Name="_menu"/>
		<ToolBarTray x:Name="_toolBarTray" Grid.Row="1"/>

		<DockPanel Grid.Row="2">
			<DockPanel.Resources>
				<Style TargetType="TextBlock">
					<Setter Property="Margin" Value="3"/>
				</Style>
			</DockPanel.Resources>
			<StackPanel DockPanel.Dock="Left" Background="LightGray">
				<Label FontWeight="Bold">Quick Links</Label>
				<ItemsControl x:Name="_quickLinks" DockPanel.Dock="Left"/>
			</StackPanel>
			<FlowDocumentScrollViewer>
				<FlowDocument Background="LightBlue">
					<Paragraph>
						This sample demonstrates the following:
					</Paragraph>
					<List>
						<ListItem>
							<Paragraph>
								How to register extensibility points in your application
							</Paragraph>
						</ListItem>
						<ListItem>
							<Paragraph>
								How to add UI elements to those extensibility points
							</Paragraph>
						</ListItem>
						<ListItem>
							<Paragraph>
								How to use CAB's command infrastructure to centralize the logic that executes when those UI
								elements are activated (typically by clicking them)
							</Paragraph>
						</ListItem>
						<ListItem>
							<Paragraph>
								How to use the WrappedCabCommand class to wrap a CAB command for easy consumption within WPF.
							</Paragraph>
						</ListItem>
					</List>
					<Paragraph>
						In this example there are three main extensibility points registered:
					</Paragraph>
					<List>
						<ListItem>
							<Paragraph>The menu bar</Paragraph>
						</ListItem>
						<ListItem>
							<Paragraph>The tool bar</Paragraph>
						</ListItem>
						<ListItem>
							<Paragraph>The quick links pane</Paragraph>
						</ListItem>
					</List>
					<Paragraph>
						Some of these primary extensibility points have secondary extensibility points. For example, the menu bar
						has secondary extensibility points for each of the top-level menu items such as File and Edit. In fact,
						the File extensibility point has yet another extensibility point within it called the FileProperties
						extensibility point. This allows items to be easily added within a subsection of the File menu. You can
						see this by checking or unchecking this checkbox:
					</Paragraph>
					<BlockUIContainer>
						<CheckBox Checked="AddPropertiesCommand" Unchecked="RemovePropertiesCommand">Register an Extra Properties command</CheckBox>
					</BlockUIContainer>
					<Paragraph>
						Similarly, checking the following checkbox will register the same command in the quick links pane to the
						left:
					</Paragraph>
					<BlockUIContainer>
						<CheckBox Checked="AddPropertiesCommandToQuickLinks" Unchecked="RemovePropertiesCommandFromQuickLinks">Register an Extra Properties command in the quick links pane</CheckBox>
					</BlockUIContainer>
					<Paragraph>
						Finally, the following button executes a CAB command by wrapping it in an instance of the WrappedCabCommand class
						and assigning it to the Button's Command property (see the code-behind). The Checkbox can be used to enable or
						disable the underlying CAB Command, which will flow through to the WPF CabCommand implementation and disable
						the button.
					</Paragraph>
					<BlockUIContainer>
						<StackPanel>
							<Button x:Name="_button">Exit</Button>
							<CheckBox IsChecked="True" Checked="EnableCabCommand" Unchecked="DisableCabCommand">Is CAB command enabled?</CheckBox>
						</StackPanel>
					</BlockUIContainer>
				</FlowDocument>
			</FlowDocumentScrollViewer>
		</DockPanel>
    </Grid>
</Window>
